<script setup lang="ts">

interface Props {
  total: number
  currentPage: number
  pageSize: number
}

interface Emits {
  (e: 'update:current-page', value: number): void
  (e: 'update:page-size', value: number): void
  (e: 'get-list'): void
}

defineProps<Props>()

const emits = defineEmits<Emits>()

const changePage = (page: number) => {
  emits('update:current-page', page)
  emits('get-list')
}

const changeSize = (size: number) => {
  emits('update:current-page', 1)
  emits('update:page-size', size)
  emits('get-list')
}

</script>

<template>
  <el-pagination :page-size="pageSize" :current-page="currentPage" @current-change="changePage" @size-change="changeSize"
    small layout="total, sizes, prev, pager, next" background :total="total" />
</template>

<style lang="scss" scoped></style>